package com.itzhigui.utils;

import org.springframework.stereotype.Component;

/**
 * 生成验证码的工具类
 *
 * @author java1412
 * @since 2023-11-10 14:56:07
 */
@Component
public class VerifyCodeUtil {

    /**
     * 生成四位数字的验证码
     *
     * @return
     */
    public String genFourDigitCode() {
        StringBuilder sb = new StringBuilder("");
        for (int i = 0; i < 4; i++) {
            int number = (int) (Math.random() * 10);
            sb.append(number);
        }
        return sb.toString();
    }
}
